home *** CD-ROM | disk | FTP | other *** search
- This ZIP contains the Visual Basic version of an assembler routine to fix
- Currency variables at a given number of decimal places. It was inspired by
- a discussion on the Compuserve MSLANG forum. The PDS version is in CFIXQB.
-
- The PDS version has ASM and OBJ files and a test QLB for PDS 7.1. The VB
- version has ASM, OBJ, and DLL files. If you want to modify the VB version,
- you'll need some way to make a DLL. If you have such a resource, you won't
- need any files other than the ones supplied... if you don't, there's no way we
- could provide enough files to help you. Don't hesitate to ask if you'd like
- help in building a DLL or adding this to your own DLL.
-
- Similar functions will also be available (with several hundred others) in
- versions of the MicroHelp Muscle libraries for QB/PDS and for Visual Basic.
-
- ----------------------------------------------------------------------
- Legalese:
-
- Written by Jim Mack, CIS 76630,2012, bix "jsmack"
- Copyright 1991, Editing Services Co. All rights reserved.
-
- Free for non-commercial use. Commercial rights freely granted on
- written request.
- ----------------------------------------------------------------------
-
- DECLARE SUB CurrFix Lib "CurrFix.DLL" (CurrVal@, ByVal Places%, ByVal Truncate%)
-
- Adjusts the passed Currency variable to remove one or more digits to the
- right of the decimal point. Floating point is avoided for maximum speed.
- If you're trying to maintain n-place values, you should call this routine
- after any operation which could add additional places, such as multiplying a
- currency value by a tax rate like 1.0525, when computing overtime wages, etc.
-
- CurrVal@ is directly modified, not returned as a function result.
-
- Places% may be 0 to 3 and will result in a value with the indicated number
- of digits beyond the decimal point. Other values are ingored with CurrVal@
- left unchanged.
-
- If Truncate% is non-zero the excess places are simply removed, otherwise
- the value is rounded using traditional financial rounding (not IEEE rounding).
-
- This code performs roughly the equivalent of the following Basic code:
-
- CVal@ = INT((CVal@ * (10^n)) + .5) / (10^n)
- ----------------------------------------------------------------------
-
-